<script type="text/javascript">
$(document).ready(function(){
           
            var ajax_load = '<img src="<?php echo Yii::app()->request->baseUrl; ?>/images/load.gif" alt="" />';
            var loadUrl = "<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=shop/shop/listDistributor";
            var addToCartUrl = "<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=shop/shop/addToCart";
            $(".view-dis").click(function () {
                $('.list-distributors').html('').show();
                $(".hide-dis").hide();
                $(".view-dis").show();
                productId = $(this).attr('product');
                
                $(".view-dis-"+productId).hide();
                $(".hide-dis-"+productId).show().text('Ẩn các đại lý');
                $('.product-'+productId).html(ajax_load)
                                  .load(loadUrl +" #list-dis","id="+productId);                
            });
            $(".hide-dis").click(function () {
                $('.list-distributors').html('').hide();
                productId = $(this).attr('product');
                $(".view-dis-"+productId).show();
                $(".hide-dis-"+productId).hide();
              
            });

           
            //var keySearch = $('.search-bg input:text').val();
            
        });
</script>

<div class="view-items">
    <div class="detail radius-5px ">
        <div class="view">
         

            <div class="product-overview-description">
                <h3><?php echo CHtml::link(CHtml::encode($data->name), array('products/view', 'id' => $data->id)); ?> <span class="view-dis radius-5px view-dis-<?php echo $data->id; ?> "  product="<?php echo $data->id; ?>">Xem các đại lý</span>
        <span class="hide-dis radius-5px hide-dis-<?php echo $data->id; ?>" product="<?php echo $data->id; ?>"></span></h3>
                <div class="desc"><?php echo Product::limitDesc($data->description,150); ?> </div>
            </div>
        </div>
        
        
    </div>
    
    <div class="list-distributors product-<?php echo $data->id; ?>"></div>
</div>

